<%--
  Created by IntelliJ IDEA.
  User: taohj
  Date: 2014/6/29
  Time: 18:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!Doctype html>
<html>
<head>
    <base href="<%=basePath%>">
    <title>政府数据开放平台</title>
    <jsp:include page="../commons/include.jsp"/>

    <link href="/resources/css/lib.css" rel="stylesheet">


    <style>




        #main { ;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            -moz-box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
            -webkit-box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            background: #FFF;
        }





    </style>

    <script type="text/javascript">
        $(function () {
            var form = $("form");


            //要从后台数据确定填的邮箱是不是已注册过了，采用回调方法
            form.validation(function (obj, params) {
                        if (obj.name == 'username') {
                            var username = form.find("input[name=username]").val();
                            var data = $.post("/user/registerVerification", {username: username});
                            data = $.parseJSON(data.responseText);
                            params.err = !data.success;
                            params.msg = data.message;
                        }

                        if (obj.name == 'email') {
                            var email = form.find("input[name=email]").val();
                            var data = $.post("/user/registerVerification", {email: email});
                            var data = $.parseJSON(data.responseText);
                            params.err = !data.success;
                            params.msg = data.message;
                        }

                        if (obj.name == 'mobileNo') {
                            var mobileNo = form.find("input[name=mobileNo]").val();
                            var data = $.post("/user/registerVerification", {mobileNo: mobileNo});
                            var data = $.parseJSON(data.responseText);
                            params.err = !data.success;
                            params.msg = data.message;
                        }
                    }
                    , {reqmark: true} //这个参数是设必填不要显示有星号，默认是有星号的
            );


            $("form button[type=submit]").on('click', function (event) {
                return form.valid(this, '填写信息不完整。');
            });

            $("body").keydown(function () {
                // 如果按下回车键
                if (window.event.keyCode == 13) {
                    $("form button[type=submit]").click();
                    //取消回车键的默认操作
                    window.event.returnValue = false
                }
            });

        })
    </script>
</head>
<body>
<div style="height: auto; width: 100%;">


    <div>
        <jsp:include page="commons/top.jsp"/>
    </div>





    <div style="font-size: 14px; font-weight: bold;clear: both; width: 800px; margin: auto;">注 册</div>
    <div style="width:800px; height:500px; margin:10px auto 0px auto;" id="main">











        <div style="width: 800px; margin: 20px auto 0px auto; padding: 0px 0px 0px 0px; height: 100%;">



            <div style="width: 200px; float: left; height: 500px; border-right: 1px solid #cccccc;"></div>

            <div style="width: 600px; float: right; padding-top: 30px; padding-left: 30px;">
                <form class="form-horizontal" ACTION="/user/register" method="post">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">账号:</label>

                        <div class="col-sm-10">
                            <input type="text" name="username" class="form-control" check-type="required"  minlength="4" maxlength="16"  placeholder="请输入账号"
                                    >
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">密码:</label>
                        <div class="col-sm-10">
                            <input type="password" name="password" class="form-control" check-type="required"  minlength="6" maxlength="16" placeholder="请输入密码"
                                    >
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-2 control-label">确认密码:</label>

                        <div class="col-sm-10">
                            <input type="password" name="repassword" class="form-control" check-type="required repassword" minlength="6" maxlength="16"  placeholder="请输入确认密码"
                                    >
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-2 control-label">邮箱地址:</label>

                        <div class="col-sm-10">
                            <input type="email" name="email" class="form-control" check-type="required email"  placeholder="请输入邮箱地址"
                                   email-message="请输入有效的邮箱">
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-2 control-label">手机号码:</label>

                        <div class="col-sm-10">
                            <input type="text" name="mobileNo" class="form-control" check-type="required"  placeholder="请输入手机号码"
                                   email-message="请输入有效的邮箱">
                        </div>
                    </div>


                    <div style="padding: 0px 30px;">
                        <span class="help-block" style="color: #000000;padding-top: 0px; font-size: 12px;">请填写真实的邮箱，在注册之后会将账号激活地址发送到你的邮箱内。</span>
                    </div>


                    <div style="margin-top: 100px;">
                        <div style="text-align: center;">
                            <button type="submit" class="btn btn-lg btn-primary btn-block" style="width: 100px; margin: auto;  ">注 册</button>
                        </div>

                        <div style=" text-align: right; padding-right: 20px; font-size: 12px;">已注册，<a href="javascript:location.href='/user/loginView';">登陆</a></div>

                    </div>
                </form>


            </div>
        </div>








</div>



</body>
</html>
